<?php
namespace app\index\controller;



use app\index\HomeBaseController;

use think\facade\Db;
class Index extends HomeBaseController
{
    /**
     *
     * @return string
     */
    public function index()
    {


        halt(sendMail());

    }

    public function hello($name = 'ThinkPHP6')
    {

        //$this->index(20,'hahe');
    }

    /*protected function setExcel($datalist,$filename){
        header("Content-type: text/html; charset=utf-8");
        $objPHPExcel = new \PHPExcel();
        $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
            ->setLastModifiedBy("Maarten Balliauw")
            ->setTitle("Office 2007 XLSX Test Document")
            ->setSubject("Office 2007 XLSX Test Document")
            ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
            ->setKeywords("office 2007 openxml php")
            ->setCategory("Test result file");
        //设置标题
        $objPHPExcel->getActiveSheet()->setTitle($filename);
        //设置表头
        $key1 = 1;
        $objPHPExcel->setActiveSheetIndex(0)
            ->setCellValue('A'.$key1, 'ID')
            ->setCellValue('B'.$key1, '用户名')
            ->setCellValue('C'.$key1, 'IP')
            ->setCellValue('D'.$key1, '添加时间')
            ->setCellValue('E'.$key1, '标题')
            ->setCellValue('F'.$key1, '开始日期')
            ->setCellValue('G'.$key1, '描述')
            ->setCellValue('H'.$key1, '评分')
            ->setCellValue('I'.$key1, '完成时间');

        //设置样式：
        $objPHPExcel->getActiveSheet()->getStyle('A1:I1')->getFont()->setBold(true); //多个单元格
        // $objPHPExcel->getActiveSheet()->getStyle('A1:H1')->getFont()->getColor()->setARGB('FFFF0000'); //设置颜色
        // $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); //单个单元格
        $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);  //列宽必须单个设置
        $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
        $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setAutoSize(true);
        $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setAutoSize(true);
        $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setAutoSize(true);
        //写入内容
        foreach($datalist as $key =>$value){
            $key1=$key+2;
            $objPHPExcel->setActiveSheetIndex(0)
                ->setCellValue('A'.$key1, $value['id'])
                ->setCellValue('B'.$key1, $value['username'])
                ->setCellValue('C'.$key1, $value['ip'])
                ->setCellValue('D'.$key1, date("Y-m-d H:i:s",$value['inputtime']))
                ->setCellValue('E'.$key1, clearhtml($value['item']))
                ->setCellValue('F'.$key1, date("Y-m-d H:i:s",$value['inputtime']))
                ->setCellValue('G'.$key1, clearhtml($value['miaoshu']))
                ->setCellValue('H'.$key1, $value['pingfen'])
                ->setCellValue('I'.$key1, date("Y-m-d H:i:s",$value['wctime']));
        }
        header('Content-Type: application/vnd.ms-excel');
        header('Content-Disposition: attachment;filename="'. $filename .'.xlsx"');
        header('Cache-Control: max-age=0');

        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); //  Excel2007
        $objWriter->save('php://output');
        exit;
    }*/
}
